import App from '../App'
import Layout from '../page/layout/Layout'

// const home = r => require.ensure([], () => r(require('../page/home/home')), 'home')
const home = r => require.ensure([], () => r(require('../page/explore/explore')), 'home')
const explore = r => require.ensure([], () => r(require('../page/explore/explore')), 'explore')
const bookmark = r => require.ensure([], () => r(require('../page/bookmark/bookmark')), 'bookmark')
const projectDetail = r => require.ensure([], () => r(require('../page/project/detail')), 'projectDetail')
const projectPreview = r => require.ensure([], () => r(require('../page/project/preview')), 'projectPreview')
const campaignList = r => require.ensure([], () => r(require('../page/campaign/list')), 'campaignList')
const crowdCreate = r => require.ensure([], () => r(require('../page/crowd/create')), 'create')
const step1 = r => require.ensure([], () => r(require('../page/crowd/Basics')), 'Basics')
const step2 = r => require.ensure([], () => r(require('../page/crowd/Story')), 'Story')
const step3 = r => require.ensure([], () => r(require('../page/crowd/Peaks')), 'Peaks')
const step4 = r => require.ensure([], () => r(require('../page/crowd/Items')), 'Items')
const step5 = r => require.ensure([], () => r(require('../page/crowd/Team')), 'Team')
const profile = r => require.ensure([], () => r(require('../page/profile/profile')), 'profile')
const createPeak = r => require.ensure([], () => r(require('../page/crowd/peaks/New')), 'createPeak')


//charts
const chart1 = r => require.ensure([], () => r(require('../page/charts/p1')), 'p1')
const chart2 = r => require.ensure([], () => r(require('../page/charts/p2')), 'p2')
const chart3 = r => require.ensure([], () => r(require('../page/charts/p3')), 'p3')
const chart4 = r => require.ensure([], () => r(require('../page/charts/p4')), 'p4')
const chart5 = r => require.ensure([], () => r(require('../page/charts/p5')), 'p5')
const chart6 = r => require.ensure([], () => r(require('../page/charts/p6')), 'p6')
const chart7 = r => require.ensure([], () => r(require('../page/charts/p7')), 'p7')
const chart8 = r => require.ensure([], () => r(require('../page/charts/p8')), 'p8')
const chart9 = r => require.ensure([], () => r(require('../page/charts/p9')), 'p9')


export default [
    {
        path: '/',
        component: App, //顶层路由，对应index.html
        children: [ //二级路由。对应App.vue
            //地址为空时跳转home页面
            {
                path: '',
                redirect: '/home'
            },
            //首页
            {
                path: '/home',
                component: home,
                meta: {
                    keepAlive: true
                }
            },
            // 查看页面
            {
                path: '/explore',
                component: explore
            },
            {
                path: '/bookmark',
                component: bookmark
            },
            // 查看页面
            {
                path: '/campaign/list',
                component: campaignList
            },
            // 查看页面
            {
                path: '/projectDetail',
                component: projectDetail,
                meta: {
                    keepAlive: false
                }
            },
            // 查看页面
            {
                path: '/projectPreview',
                component: projectPreview
            },
            // 查看页面
            {
                path: '/profile',
                component: profile
            },
            // 查看页面
            {
                path: '/create',
                component: crowdCreate,
                name: 'create'
            },
            // 创建
            {
                path: '/crowd',
                component: Layout,
                redirect: 'create',
                children: [
                    {
                        path: 'step1',
                        component: step1,
                        name: 'step1',
                    },
                    {
                        path: 'step2',
                        component: step2,
                        name: 'step2',
                    },
                    {
                        path: 'step3',
                        component: step3,
                        name: 'step3',
                    },
                    {
                        path: 'step4',
                        component: step4,
                        name: 'step4',
                    },
                    {
                        path: 'step5',
                        component: step5,
                        name: 'step5',
                    },
                    {
                        path: 'peaks/new',
                        component: createPeak,
                        name: 'createPeak',
                    }


                ]
            }
        ]
    },
    //首页
    {
        path: '/p1',
        component: chart1
    }, {
        path: '/p2',
        component: chart2
    }, {
        path: '/p3',
        component: chart3
    }, {
        path: '/p4',
        component: chart4
    }, {
        path: '/p5',
        component: chart5
    }, {
        path: '/p6',
        component: chart6
    }, {
        path: '/p7',
        component: chart7
    }, {
        path: '/p8',
        component: chart8
    }, {
        path: '/p9',
        component: chart9
    }]